<script type="text/javascript">
    $(function(){
        trbgmoves('#d3dff2');
    })
    function shitss(id){
        var sid= $("#sid"+id).val();
        window.open('http://www.aliexpress.com/snapshot/'+sid+'.html');
    }
    function tijiao(){
        var fileField=$('#fileField2').val();
        if(fileField==''){
            alert('<?=lang('smtqxzwj')?>！！！');
            return false;
        }
    }
    function tijiao2(){
        var fileField=$('#fileField').val();
        if(fileField==''){
            alert('<?=lang('smtqxzwj')?>！！！');
            return false;
        }
    }
    function tuisong(id){

        var id=id.substring(2);
        $.ajax({
            type:'post',
            data:'orderid='+id,
            timeout:15000,
            url:"<?=blang_url('ajax/ajax/tuisongorder/')?>",
            beforeSend: function () {
                $("#sp"+id).html("<img src='/resource/images/ajax-loader.gif'>");
            },
            success: function (msg) {
                if(msg.length==10) {
                    alert("<?=lang('smttscg')?>！");
                    $("#sp"+id).html("<a href='"+"<?=blang_url('orders/order/inDetails')?>/"+msg+"'><?=lang('smtckdd')?></a>");
                }else{
                    alert("<?=lang('smttssb')?>！！！"+msg);
                    $("#sp"+id).html("<a href='javascript:void(0)' id='ts"+id+"' onclick='tuisong(id)'><?=lang('smttsdd')?></a>");
                }
            },
            error: function (e, jqxhr, settings, exception) {
                $("#sp"+id).text("<?=lang('smtqqcw')?>...");
            }
        });
    }
</script>
<!--top结束-->
<div class="mian">
    <div class="mian1">
        <div class="mian2">
            <!--left start-->
            <?php $this->load->view('defaults/common/left');?>
            <!--left end-->

            <!--right start-->
            <div class="right">
                <!--breadcrumb start-->
                <div class="righta"><?=$this->breadcrumb->generateHTML();?> </div>
                <!--breadcrumb end-->

                <!-- contents start -->
                <div id="contents" style="width: 1200px">
                    <div id="ct_search" style="width: 1200px">
                        <form action="<?=blang_url('orders/Smtexcel/'.$fct.'/list')?>" method="post" enctype="multipart/form-data" name="excelform" >
                            <table id="search_tb" style="width: 1200px">
                                <tr>
                                    <td>
                                        <input name="action" type="hidden" value="submit" />
                                        <input name="filesname" id="filesname" type="hidden" value=<?=$filesname?> />
                                        <input type="file" name="fileField" id="fileField" />
                                        <input type="submit" name="button" id="button" onclick="return tijiao2()" value="<?=$numto==0?lang('smtscwjscyl'):lang('smtqrwwcrsjk')?>" />
                                        <?=$tishi?>
                                    </td>
                                </tr>
                            </table>
                        </form>
                        <form action="<?=blang_url('orders/Smtexcel/smtlist')?>" method="post" name="searchform" >
                            <table id="search_tb" style="width: 1200px">
                                <tr>
                                    <td >
                                        <input name="id" value="" placeholder="<?=lang('smtddh')?>" />&nbsp;&nbsp;
                                        <input name="name" value="" placeholder="<?=lang('smtspm')?>" />&nbsp;&nbsp;
                                        <?=lang('smtgj')?>：<select name="country">
                                            <option value=""><?=lang('smtqxzgj')?></option>
                                            <?php foreach($gj as $row):?>
                                                <option value="<?=$row['site_prefix']?>"><?=$row['site_prefix']?></option>
                                            <?php endforeach;?>
                                        </select>
                                        <input type="submit" name="searchSubmit" value="<?=lang('smtcx')?> " />&nbsp;&nbsp;&nbsp;&nbsp;
                                    </td>
                                </tr>
                            </table>
                        </form>
                        <form action="<?=blang_url('orders/Smtexcel/upload/time')?>" method="post" enctype="multipart/form-data" name="excelform" >
                            <table id="search_tb" style="width: 1200px">
                                <tr>
                                    <td >
                                        <input name="action" type="hidden" value="submit" />
                                        <input type="file" name="fileField" id="fileField2" />
                                        <input type="submit" name="button" id="button" value="<?=lang('smtwbsjzr')?>" onclick="return tijiao()"/>&nbsp;&nbsp;&nbsp;&nbsp;
                                    </td>
                                </tr>
                            </table>
                        </form>
                    </div>
                    <div class="ct_content" style="width: 1200px">
                            <table style="width: 1200px">
                                <tr>
                                    <td width="8%"><?=lang('smtddh')?></td>
                                    <td width="51%"><?=lang('smtspm')?></td>
                                    <td width="7%"><?=lang('smtddsj')?></td>
                                    <td width="5%"><?=lang('smtwbjg')?></td>
                                    <td width="8%"><?=lang('smtwbkssj')?></td>
                                    <td width="8%"><?=lang('smtwbjssj')?></td>
                                    <td width="3%"><?=lang('smtgj')?></td>
                                    <td width="11%"><?=lang('smtcz')?></td>
                                </tr>
                                <?php foreach($query as $key=>$v):
                                    $arr=explode(',',$v['snapshot_id']);
                                    $at=explode('"',$arr[0]);
                                    ?>
                                    <tr class="moves"   id="<?=$v['parent_order_id']?>" ondblclick="shitss(id)">
                                        <td><input type="hidden" id="sid<?=$v['parent_order_id']?>" name="sid" value="<?=$at[3]?>"><?=$v['parent_order_id']?></td>
                                        <td><?=$v['item_name']?></td>
                                        <td><?=substr($v['pay_order_time'],0,10)?></td>
                                        <td><?=$v['warrantyPriceAmt']?></td>
                                        <td><?=$v['warranty_start_time']==0?0:date('Y/m/d H:i:s',$v['warranty_start_time'])?></td>
                                        <td><?=$v['warranty_end_time']==0?0:date('Y/m/d H:i:s',$v['warranty_end_time'])?></td>
                                        <td><?=$v['buyer_country_id']?></td>
                                        <td>
                                            <a href="<?=blang_url('orders/Smtexcel/smtxq/'.$v['parent_order_id'])?>"><?=lang('smtckxq')?></a>
                                            <span id="sp<?=$v['parent_order_id']?>">
                                                <?php if($v['mtorderid']){?>
                                                    <a href="<?=blang_url('orders/order/inDetails/'.$v['mtorderid'])?>"><?=lang('smtckdd')?></a>
                                                <?php }else{ ?>
                                                    <a href="javascript:void(0)" id="ts<?=$v['parent_order_id']?>" onclick="tuisong(id)"><?=lang('smttsdd')?></a>
                                                <?php }?>
                                            </span>
                                            <!--<a href="<?=blang_url('orders/Smtexcel/deletesc2/'.$v['parent_order_id'])?>" onclick="return confirm('delete？')">删除</a>-->
                                        </td>
                                    </tr>
                                <?php endforeach; ?>
                                <?php if($eplist){ ?>
                                    <tr>
                                        <td colspan="8" align="center"><h3><span style="color: blue">以下是数买通接口查询信息</span></h3></td>
                                    </tr>
                                    <?php foreach($eplist as $key=>$var):?>
                                    <tr class="moves">
                                        <td><?=$key?></td>
                                        <td colspan="7"><?=$var?></td>
                                    </tr>
                                <?php endforeach;}?>
                                <tr><td colspan="8" align="center"><?=$pageshow?></td></tr>
                            </table>
                    </div>
                </div>
                <!-- contents end -->
            </div>
            <!--right end-->
        </div>
    </div>
</div>

